package model;

import java.io.Serializable;

/**
 * @author chang created for GUI to store the last movement of the game.
 */
@SuppressWarnings("serial")
public class LastAction implements Serializable {
	private Player player1;
	private Player player2;
	private Territory t1;
	private Territory t2;
	private LastActionEnum aEnum;

	/**
	 * this LastAction is design for addTroop
	 * 
	 * @param p1
	 *            player information.
	 * @param t1
	 *            territory in which troop changed
	 * @param e1
	 *            movement enum should be "addTroop"
	 */
	public LastAction(Player p1, Territory t1, LastActionEnum e1) {
		this.player1 = p1;
		this.player2 = null;
		this.t1 = t1;
		this.t2 = null;
		this.aEnum = e1;
	}

	/**
	 * this LastAction is design for attack.
	 * 
	 * @param p1
	 *            attacker
	 * @param p2
	 *            defender
	 * @param t1
	 *            original Territory
	 * @param t2
	 *            target Territory
	 * @param e1
	 *            movement enum: should be "attack"
	 */
	public LastAction(Player p1, Player p2, Territory t1, Territory t2,
			LastActionEnum e1) {
		this.player1 = p1;
		this.player2 = p2;
		this.t1 = t1;
		this.t2 = t2;
		this.aEnum = e1;
	}

	/**
	 * design for fortify
	 * 
	 * @param p1
	 *            player who move troops
	 * @param t1
	 *            original territory
	 * @param t2
	 *            target territory
	 * @param e1
	 *            movement enum should be "fortify"
	 */
	public LastAction(Player p1, Territory t1, Territory t2, LastActionEnum e1) {
		this.player1 = p1;
		this.player2 = null;
		this.t1 = t1;
		this.t2 = t2;
		this.aEnum = e1;
	}

	/**
	 * design for both endTurn and tradeCards
	 * 
	 * @param p1
	 *            action performer
	 * @param e1
	 *            can be "endTurn" or "tradeCards"
	 */
	public LastAction(Player p1, LastActionEnum e1) {
		this.player1 = p1;
		this.player2 = null;
		this.t1 = null;
		this.t2 = null;
		this.aEnum = e1;
	}

	/**
	 * @return the first player of the movement sometimes null.
	 */
	public Player getPlayer1() {
		return this.player1;
	}

	/**
	 * @return the second player of movement sometimes null.
	 */
	public Player getPlayer2() {
		return this.player2;
	}

	/**
	 * @return the first territory sometimes null.
	 */
	public Territory getTerritory1() {
		return this.t1;
	}

	/**
	 * @return the second territory sometimes null.
	 */
	public Territory getTerritory2() {
		return this.t2;
	}

	/**
	 * @return the Action Enum.
	 */
	public LastActionEnum getLastActionEunm() {
		return this.aEnum;
	}
}
